import http from '@/http'

export default {
    /**
     * 产区列表
     * @param {number} page  页码
     * @param {Function} success 回调
     */
    list(page, success) {
        http.get('area/list', {
            page: page
        }, success);
    },

    countries(success){
      http.get('countries', {},success);
    },
    /**
     * 产区检索
     * @param {number} page 页码
     * @param {string} key 关键词
     * @param {Function} success 回调
     */
    search(page, key, success) {
        http.get('area/search', {
            page: page,
            key: key
        }, success);
    },
    /**
     * 添加产区
     * @param {Object} area 产区
     * @param {Function} success 回调
     */
    save(area, success) {
        http.postBody('area/add', area, success)
    },
    /**
     * 更新产区
     * @param {Object} area 产区
     * @param {Function} success 回调
     */
    update(area, success) {
        http.postBody('area/edit', area, success)
    },
    /**
     * 删除产区
     * @param {number} id 产区id
     * @param {Function} success 回调
     */
    delete(id, success) {
        http.get('area/delete/' + id, success);
    }
}
